# frv testcase for mqlclrhs $FRi,$FRj,$FRj
# mach: fr450

	.include "testutils.inc"

	start

	.global mqlclrhs
mqlclrhs:
	set_fr_iimmed	0x1000,0x2000,fr4
	set_fr_iimmed	0xe800,0xd800,fr5
	set_fr_iimmed	0x0800,0x0800,fr6
	set_fr_iimmed	0x0800,0x0800,fr7
	mqlclrhs	fr4,fr6,fr8
	test_fr_limmed	0x1000,0x2000,fr8
	test_fr_limmed	0xe800,0xd800,fr9

	set_fr_iimmed	0x1000,0x2000,fr4
	set_fr_iimmed	0xe800,0xd800,fr5
	set_fr_iimmed	0xf800,0xf800,fr6
	set_fr_iimmed	0xf800,0xf800,fr7
	mqlclrhs	fr4,fr6,fr8
	test_fr_limmed	0xf000,0xe000,fr8
	test_fr_limmed	0x1800,0x2800,fr9

	set_fr_iimmed	0x1000,0x1000,fr4
	set_fr_iimmed	0x1000,0x1000,fr5
	set_fr_iimmed	0xf000,0xf800,fr6
	set_fr_iimmed	0x0800,0x1000,fr7
	mqlclrhs	fr4,fr6,fr8
	test_fr_limmed	0x0000,0xf000,fr8
	test_fr_limmed	0x1000,0x0000,fr9

	set_fr_iimmed	0xf000,0xf000,fr4
	set_fr_iimmed	0xf000,0xf000,fr5
	set_fr_iimmed	0xf000,0xf800,fr6
	set_fr_iimmed	0x0800,0x1000,fr7
	mqlclrhs	fr4,fr6,fr8
	test_fr_limmed	0x0000,0x1000,fr8
	test_fr_limmed	0xf000,0x0000,fr9

	set_fr_iimmed	0x8000,0x8000,fr4
	set_fr_iimmed	0x8000,0x8000,fr5
	set_fr_iimmed	0x8000,0x7fff,fr6
	set_fr_iimmed	0x8001,0x0000,fr7
	mqlclrhs	fr4,fr6,fr8
	test_fr_limmed	0x0000,0x8000,fr8
	test_fr_limmed	0x7fff,0x8000,fr9

	set_fr_iimmed	0x7fff,0x7fff,fr4
	set_fr_iimmed	0x7fff,0x7fff,fr5
	set_fr_iimmed	0x8000,0x7fff,fr6
	set_fr_iimmed	0x8001,0x0000,fr7
	mqlclrhs	fr4,fr6,fr8
	test_fr_limmed	0x0000,0x0000,fr8
	test_fr_limmed	0x0000,0x7fff,fr9

	set_fr_iimmed	0x8001,0x8001,fr4
	set_fr_iimmed	0x8001,0x8001,fr5
	set_fr_iimmed	0x8000,0x7fff,fr6
	set_fr_iimmed	0x8001,0x0000,fr7
	mqlclrhs	fr4,fr6,fr8
	test_fr_limmed	0x0000,0x0000,fr8
	test_fr_limmed	0x0000,0x8001,fr9

	set_fr_iimmed	0x8000,0x8000,fr4
	set_fr_iimmed	0x0001,0xffff,fr5
	set_fr_iimmed	0x0001,0xffff,fr6
	set_fr_iimmed	0x8000,0x8000,fr7
	mqlclrhs	fr4,fr6,fr8
	test_fr_limmed	0x8000,0x7fff,fr8
	test_fr_limmed	0x0000,0x0000,fr9

	pass
